import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { HomeResolve } from './home-resolve/home.resolve';
import { SheetListComponent } from './sheet-list/sheet-list.component';
import { SheetListResolve } from './sheet-resolve/sheet-list.resolve';
import { SheetDetailComponent } from './sheet-detail/sheet-detail.component';
import { SheetDetailResolve } from './sheet-resolve/sheet-detail.resolve';
import { SongDetailComponent } from './song-detail/song-detail.component';
import { SongDetailResolve } from './song-resolve/song-detail.resolve';
import { SingerDetailComponent } from './singer-detail/singer-detail.component';
import { SingerDetailResolve } from './singer-resolve/singer-detail.resolve';

const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full' },
  {
    path: 'home',
    component: HomeComponent,
    resolve: { homeData: HomeResolve },
    data: { title: '发现', reuse: true }
  },
  {
    path: 'sheets',
    component: SheetListComponent,
    resolve: { sheetData: SheetListResolve },
    data: { title: '歌单列表', reuse: true }
  },
  {
    path: 'sheets/:id/detail',
    component: SheetDetailComponent,
    resolve: { sheetDetail: SheetDetailResolve },
    data: { title: '歌单详情', reuse: true }
  },
  {
    path: 'songs/:id/detail',
    component: SongDetailComponent,
    resolve: { songDetailModel: SongDetailResolve },
    data: { title: '歌曲详情', reuse: false }
  },
  {
    path: 'singers/:id/detail',
    component: SingerDetailComponent,
    resolve: { singerDetail: SingerDetailResolve },
    data: { title: '歌手详情', reuse: true }
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class RoutesRoutingModule { }
